<?php
    session_start();

    if (!isset($_SESSION['user'])){
        header( 'Location: login.php');
    } 
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <?php require_once('../modulos/header.php'); ?> 
        
            <body  style="background-image: url(../img/rayas_verticales.jpg); background-size: 100%;">
               
                <?php require_once('../modulos/navbar.php'); ?>
                
                <div class='row'>
                    <br><br><br>
                    <div class="col-md-6 text-center col-lg-offset-3" style="background: #e7e7e7; border-radius: 15px;">
                        <h1>Oponentes</h1>
                        <p class="lead">Estos son los oponentes almacenados en el sistema.</p>
                        <br>
                        <table id="tablita" class="table">
                                <thead>
                                    <tr style="background-color: rgba(86,61,124,.15);">
                                        <th>Nombre</th>
                                        <th>Estadio</th>
                                        <th></th>
                                    </tr>
                                </thead>
                                <tbody style="background-color: #f9f9f9;">
                                    <?php 
                                        require_once '../conex.php';

                                        $qr = "SELECT * FROM oponentes";
                                        $ejecutar = mysql_query($qr);

                                        while ($fila = mysql_fetch_array($ejecutar)){ ?>     
                                    <tr>
                                    
                                        <th>
                                            <?php echo $fila['Nombre']; ?>
                                        </th>
                                        <th>
                                            <?php echo $fila['Estadio']; ?>
                                        </th>
                                        <th>
                                            <form method="POST" action="../modificar/oponentes.php">
                                                <input name="idOpo" value=" <?php echo $fila['idOponente'].'/'.$fila['Nombre'].'/'.$fila['Estadio']; ?> " style="display: none;">
                                                <button id="b_modificar" onclick="mostrar();" class="btn btn-primary">Modificar</button> 
                                            </form>
                                        </th>
                                    </tr>
                                        <?php
                                        }
                                        mysql_close();
                                        ?>                 
                                </tbody>
                            </table>                          
                </div> <!-- /container -->          
            </div>           
                
        <script>
            $(document).ready(function(){
                $('#tablita').dataTable({
                    "iDisplayLength": 5,
                            "bLengthChange": false,
                            "bFilter": false,
                            "ordering": false,
                            "pagingType": "simple",
                            "language": {
                                "sInfo": " ",
                                "paginate": {
                                  "previous": "Atrás",
                                  "next": "Siguiente"
                                }    
                            }
                });
            });
        </script> 
    </body>
</html>